package com.bwie.utils;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2025/6/20 10:58
 */

public class TokenUtils {

    public static Integer getUserId(String token) {
        Claims body = Jwts.parser().setSigningKey("123456").parseClaimsJws(token).getBody();
        return body.get("userId", Integer.class);
    }

    public static String getUserName(String token) {
        Claims body = Jwts.parser().setSigningKey("123456").parseClaimsJws(token).getBody();
        return body.get("userName", String.class);
    }
}
